function postData() {
    // Function to handle form submission
    const handleSubmit = (event) => {
        event.preventDefault();
        // Get the form input values
        const Storage = document.getElementById('StorageInput').value;
        const Target = document.getElementById('TargetInput').value;
        // Create an object with the new hike data
        const newStorage = {
            Storage: Storage,
            Target:Target
        };
        // Check if the hikes object exists in local storage
        let Storages = localStorage.getItem('Storages');
        if (!Storages) {
            // Create a new hikes object if it doesn't exist
            Storages = {
                "Storages": []
            };
        } else {
            Storages = JSON.parse(Storages);
        }
        // Add the new hike to the hikes object
        Storages.Storages.push(newStorage);
        // Save the updated hikes object to local storage
        localStorage.setItem('Storages', JSON.stringify(Storages));
        // Redirect to main.html
        window.location.href = 'indexother.html';
    };
    // Add event listener to the form submit event
    const form = document.getElementById('newStorageForm');
    form.addEventListener('submit', handleSubmit);
}
postData();
